#include "service.h"
#include "datamanager.h"
using namespace std;

Service::Service()
{
    //ctor
}
void Service::addRecord()
{
    Member member;
    Owns own;
    while(1)
    {
        string cmd;
        cin>>cmd>>cmd;
        if(cmd=="add-member")
        {
            string name,address,occupation;
            cin>>name>>address>>occupation;

            if(int id=member.addMember(name,address,occupation))
                cout<<"OK."<<name<<"'s member id is "<<id<<endl;
        }
        else if(cmd=="add-card")
        {
            string name,type;

            int times=-1;
            cin>>name>>type;
            if(type=="次卡")
            {
                cin>>times;
                own.addCard(name,type,times);
                cout<<"OK.A new "<<type<<" with "<<times<<" times added to "<<name<<endl;
            }
            own.addCard(name,type,times);
            cout<<"OK.A new "<<type<<" added to "<<name<<endl;
        }
    }
}

Service::~Service()
{
    //dtor
}
